package py.fpuna.aiwa.compraventa.droid.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import android.util.Base64;
import android.util.Log;

public class PasswordHelper {

	public static String encriptPassword(String nombreUsuario, String plainPass) {
		MessageDigest md5;
		try {
			md5 = MessageDigest.getInstance("MD5");
		} catch (NoSuchAlgorithmException ex) {
			Log.e("Error", "No se encontro algoritmo", ex);
			throw new RuntimeException(ex);
		}
		return new String(Base64.encode(
				md5.digest((nombreUsuario + "{"+ plainPass + "}").getBytes())
				,Base64.DEFAULT)).trim();
	}
}
